Imports System.Windows.Forms
Imports KeyStatus.clsConfig

Public Class frmSetup

  Private mObjConfigStruct As New clsConfigStruct

  Public Property mPrpConfigStruct() As clsConfigStruct
    Get
      Return mObjConfigStruct
    End Get
    Set(ByVal value As clsConfigStruct)
      mObjConfigStruct = value
    End Set
  End Property

  Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
    mObjConfigStruct.mPrpAutoRun = clsChkRegKey.mPrSetKey(mObjConfigStruct.mPrpAutoRun)
    Me.DialogResult = System.Windows.Forms.DialogResult.OK
    Me.Close()
  End Sub

  Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click
    Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
    Me.Close()
  End Sub

  Private Sub trkOpacity_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles trkOpacity.Scroll
    mObjConfigStruct.mPrpOpacity = trkOpacity.Value
    mainform.Opacity = trkOpacity.Value / 100
  End Sub

  Private Sub chkAutoRun_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkAutoRun.CheckedChanged
    chkAutoRun.Checked = clsChkRegKey.mPrSetKey(chkAutoRun.Checked)
    mObjConfigStruct.mPrpAutoRun = chkAutoRun.Checked
  End Sub

  Private Sub pnlColor_Paint(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pnlColor.Click
    Dim lObjColorDalg As New ColorDialog
    With lObjColorDalg
      .AllowFullOpen = True
      .AnyColor = True
      .Color = pnlColor.BackColor
      .FullOpen = True
      If .ShowDialog() = Windows.Forms.DialogResult.OK Then
        If .Color = Color.Magenta Then .Color = Color.Red
        pnlColor.BackColor = .Color
      End If
    End With
    mObjConfigStruct.mPrpColor = pnlColor.BackColor
    mainform.lblCapLck.BackColor = pnlColor.BackColor
    mainform.lblScrLck.BackColor = pnlColor.BackColor
    mainform.lblNumLck.BackColor = pnlColor.BackColor

  End Sub

  Private Sub frmSetup_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    clsChkRegKey.mPraChkKey()
    chkAutoRun.Checked = mObjConfigStruct.mPrpAutoRun
    trkOpacity.Value = mObjConfigStruct.mPrpOpacity
    pnlColor.BackColor = mObjConfigStruct.mPrpColor
  End Sub

End Class
